package com.manager.core.ad.utils;

import android.widget.FrameLayout;
import com.bykv.vk.openvk.VfSlot;
import com.bykv.vk.openvk.mediation.MediationConstant;
import com.qq.e.ads.cfg.VideoOption;
import java.util.Map;

public class GdtUtils {

    public static VideoOption getGMVideoOption(VfSlot adSlot) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        VideoOption.Builder builder = new VideoOption.Builder();
        if (adSlot != null && adSlot.getMediationAdSlot() != null && adSlot.getMediationAdSlot().getExtraObject() != null) {
            Map extra = adSlot.getMediationAdSlot().getExtraObject();
            if (extra.get("gdt_auto_play_policy") instanceof Integer) {
                builder.setAutoPlayPolicy((Integer) extra.get("gdt_auto_play_policy"));
            }
            if (extra.get("gdt_auto_play_muted") instanceof Boolean) {
                builder.setAutoPlayMuted((Boolean) extra.get("gdt_auto_play_muted"));
            }
            if (extra.get("gdt_detail_page_muted") instanceof Boolean) {
                builder.setDetailPageMuted((Boolean) extra.get("gdt_detail_page_muted"));
            }
            if (extra.get("gdt_enable_detail_page") instanceof Boolean) {
                builder.setEnableDetailPage((Boolean) extra.get("gdt_enable_detail_page"));
            }
            if (extra.get("gdt_enable_user_control") instanceof Boolean) {
                builder.setEnableUserControl((Boolean) extra.get("gdt_enable_user_control"));
            }
        }
        return builder.build();
    }

    public static FrameLayout.LayoutParams getNativeAdLogoParams(VfSlot adSlot) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        if (adSlot == null) {
            return null;
        }
        if (adSlot.getMediationAdSlot() == null) {
            return null;
        }
        Map extra = adSlot.getMediationAdSlot().getExtraObject();
        if (extra != null) {
            Object o = extra.get(MediationConstant.KEY_GDT_NATIVE_LOGO_PARAMS);
            if (o instanceof FrameLayout.LayoutParams) {
                return (FrameLayout.LayoutParams) o;
            }
        }
        return null;
    }

    public static int getGDTMaxVideoDuration(VfSlot adSlot) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        if (adSlot == null) {
            return 0;
        }
        if (adSlot.getMediationAdSlot() == null) {
            return 0;
        }
        Map extra = adSlot.getMediationAdSlot().getExtraObject();
        if (extra != null) {
            Object o = extra.get(MediationConstant.KEY_GDT_MAX_VIDEO_DURATION);
            if (o instanceof Integer) {
                return (Integer) o;
            }
        }
        return 0;
    }

    public static int getGDTMinVideoDuration(VfSlot adSlot) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        if (adSlot == null) {
            return 0;
        }
        if (adSlot.getMediationAdSlot() == null) {
            return 0;
        }
        Map extra = adSlot.getMediationAdSlot().getExtraObject();
        if (extra != null) {
            Object o = extra.get(MediationConstant.KEY_GDT_MIN_VIDEO_DURATION);
            if (o instanceof Integer) {
                return (Integer) o;
            }
        }
        return 0;
    }
}
